<template>
  <div class='list'>
    <!-- {{listData}} -->
    <ul>
      <li v-for="(item, index) in listData" :key="index">
        <div class="info">
          <img :src="item.wx_pic||item.photo" alt="">
          <p><span>姓名：<span class="color-gray">{{item.name}}</span></span><span>班级：<span class="color-gray">{{item.class}}</span></span></p>
          <span v-if="search.cate==1" class="switch"><van-switch v-model="item.isPassed" active-color="#00998d" /><span :class="{state:true,pr:true,'color-red':!item.isPassed,'color-green':item.isPassed}">{{item.isPassed?"通过":"不通过"}}</span></span>
          <span v-else :class="{switch:true,just:true,'color-red':item.state==-1,'color-green':item.state==1}">{{item.state==1?"通过":"不通过"}}</span>
        </div>
        <div class="detail">
          <p><span>请假原因：</span><span class="color-gray">{{item.reason}}</span></p>
          <p><span>请假时间：</span><span class="color-gray">{{item.start_time}}~{{item.end_time}}</span></p>
          <p><span>申请时间：</span><span class="color-gray">{{item.time}}</span></p>
          <p><span>附件照片：</span><span class="color-gray" v-if="item.url.length==0">暂无</span></p>
          <p class="imgs-box" v-if="item.url.length>0">
            <img v-for="(img, index) in item.url" :key="index" @click="showBigImg(item.url,index)" :src="img" alt="">
          </p>
        </div>
      </li>
    </ul>
    <p class="no-data" v-show="listData.length==0">暂时没有数据~</p>
  </div>
</template>
<script>
export default {
  props:['search','listData','routerDetail'],
  components: {},
  name: "",
  data() {
    return {};
  },
  methods: {
    showBigImg(array,index){
      ImagePreview(array,index)
    }
  },
  created() {}
};
</script>
<style lang="scss" scoped>
.list {

  li{
    padding: 20px 30px;
    box-sizing: border-box;
    border-bottom: 1px solid #ddd;
    
    .info{
      display: flex;
      box-sizing: border-box;
      border-bottom: 1px solid #ddd;
      font-size: 13px;
      height: 140px;

      img{
        width: 120px;
        height: 120px;
        border-radius: 50%;
        margin-right: 20px;
        box-shadow: 1px 1px 3px 1px #333;
      }

      p{
        display: flex;
        flex-direction: column;
        

        span{
          margin-top: 10px;
        }
      }
      .switch{
        margin-left: auto;
        padding-right: 10px;

        .state{
          top: -10px;
          left: 5px;
        }
      }
      .just{
        padding-right: 0;
      }
    }
    .color-gray{
      color: #999
    }
    .detail{
      padding-top: 10px;
    }
    .imgs-box{
      display: flex;
      flex-wrap: wrap;
      img{
        width: 120px;
        height: 120px;
      }
    }
  }
  li:nth-of-type(1){
    border-top: none!important;
    box-shadow: 0px -2px 2px 0px #ddd;
  }
}
</style>